/**
 * @file nav2param_manager.h
 * @author your name (you@domain.com)
 * @brief 
 * @version 0.1
 * @date 2025-04-01
 * 
 * @copyright Copyright (c) 2025
 * 
 */


#include <memory>
#include <vector>
#include "rclcpp/rclcpp.hpp"
#include "rclcpp/parameter_client.hpp"
#include "yaml-cpp/yaml.h"

class Nav2ParamManager
{
public:
    explicit Nav2ParamManager(rclcpp::Node::SharedPtr node)
        : node_(node) {}
    /**
     * @brief 核心函数
     * 
     * @param yaml_path yaml文件路径
     */
    void reloadParameters(const std::string &yaml_path);

private:
    rclcpp::Node::SharedPtr node_;

    void processNodeParameters(const std::string &node_name, const YAML::Node &params_node);

    rclcpp::Parameter parseScalarParameter(const std::string &name, const YAML::Node &value);

    rclcpp::Parameter parseArrayParameter(const std::string &name, const YAML::Node &value);

    void handleParameterFuture(std::shared_future<std::vector<rcl_interfaces::msg::SetParametersResult>> future,
                               const std::string &node_name);
};